import java.util.HashSet;
import java.util.Random;
import java.util.Set;

public class Lab_02calculation_V03 {
    public static void main(String[] args) {
        Random rand = new Random();
        Set<String> questions = new HashSet<>(); // 用Set去重

        while (questions.size() < 50) { // 生成50个不重复的题目
            int num1 = rand.nextInt(100);
            int num2 = rand.nextInt(100);
            String operator = rand.nextBoolean() ? "+" : "-";
            int result = operator.equals("+") ? num1 + num2 : num1 - num2;

            // 格式化算式为字符串，添加到Set
            String question = num1 + " " + operator + " " + num2 + " = " + result;
            questions.add(question);
        }

        // 输出所有生成的题目
        for (String question : questions) {
            System.out.println(question);
        }
    }
}
